home *** CD-ROM | disk | FTP | other *** search
- Variations on a theme.
-
- This short program is an adaptation of the hard disk head parking utility that
- Barry Nance did in message #65. Barry's program worked fine on WD - ST225 disk
- combinations, but failed on my true blue IBM/XT 10 meg'er (I almost hate to
- admit to that, but it's what I use at work, and the machine was there before I
- was!). The DTC controller that IBM supplied does not do an actual seek until
- some read/write request is attempted. I tried all sorts of ways to fool it
- into working with Barry's program, but no go.
-
- What does work is to reset, then step the head out track by track until the
- last cylinder is reached. To take care of partitioning schemes and other dirty
- tricks, I try to step the head past the end of the cylinder. If the head is
- really and truely at the end of the disk, the controller will return a seek
- error, in which case the program terminates. If not, it keeps trying until the
- expected seek error arrives.
-
- WARNING TO CLONE BOARDS: We've tried this program on the following
- combinations: 10-meg w/DTC controller, 10-meg w/WD controller, and 20-meg w/WD
- controller. If you are not *absolutely sure* the algorithm described will work
- with your controller board without making all sorts of protesting noises, try
- it with timid feet the first time, ready to hit that big red button.
-
- NOTE: At the end, the program disables all interrupts and halts. This makes it
- easy to use in batch files for turn-key systems, and requires that the user
- actually turns the power off (with heads properly parked) before moving the
- computer. The folks here at ICI use this program in our sales demo units,
- which are Compaq portables.
-
- Assemble, link, and EXE2BIN this program to turn it into .COM format.
- Here goes.
-
- ;-------------------------------------------------------------------------------
- PAGE ,132
- ;
- ; This program parks the head on the hard disk. It moves the head to the last
- ; track (which is reserved for this purpose), and then halts the system. This
- ; requires the system to be shut down after parking, and allows the PARK program
- ; to be used in batch files. The code is a modification of a public domain
- ; program by Barry Nance as listed in the MS.DOS/COMMANDS conference in BIX.
- ;
- park segment para public 'code'
- assume cs:park,ds:park,es:park
- ;
- org 0100h
- ;
- start proc far
- ;
- mov ah,9 ; copyright notice
- mov dx,offset promptc
- int 33
- ;
- mov ax,1100h ; recalibrate hard drive #0
- mov dx,0080h
- int 19
- jnc hdisk
- ;
- no_hd: mov ah,9 ; 'No hard disk ...'
- mov dx,offset prompte
- int 33
- mov ah,76 ; terminate, return error code FF
- mov al,0FFh
- int 33
- ;
- hdisk: mov ax,0800h ; get disk parameters for hard drive #0
- mov dx,0080h
- int 19
- ;
- xchg ch,cl ; max cyl # = NNxxxxxx.NNNNNNNN
- mov dl,cl
- mov cl,6
- shr ch,cl
- mov cl,dl ; max cyl # = [cx]
- inc cx
- inc cx
- ;
- mov di,offset prompth ; convert max cyl # to ASCII decimal
- conv1: mov ax,cx ; get # of cyl in ax
- mov dx,0 ; clear dx for DIV instruction
- mov bx,1000
- div bx ; get 1000's in ax, rem in dx
- cmp ax,0 ; any 1000's?
- je conv2
- add al,'0' ; convert to ascii
- stosb
- conv2: mov ax,dx ; get remainder
- mov bl,100
- div bl ; get 100's in al, rem in ah
- add al,'0' ; convert 100's to ascii
- stosb
- conv3: mov al,ah ; get remainder
- mov ah,0
- mov bl,10
- div bl ; get 10's in al, 1's in ax
- add al,'0' ; convert 10's to ascii
- stosb
- mov al,ah ; get 1's
- add al,'0' ; convert 1's to ascii
- stosb
- ;
- push cx
- mov ah,9 ; '<cr> Parking the hard disk <cr>'
- mov dx,offset prompt1
- int 33
- mov ah,9 ; 'Moving the head(s) ....
- mov dx,offset prompt2
- int 33
- pop cx
- ;
- mov seek_num,0001 ; step disk out to final cylinder
- verlp: push cx
- mov ax,0401h ; verify
- mov cx,seek_num
- mov dx,0080h
- int 19
- vl1: add seek_num,0100h ; increment cyl number
- jnc vl2 ; test for roll over to upper 2 bits
- add seek_num,0040h ; finish incrementing cyl number
- vl2: pop cx
- loop verlp
- ;
- vl3: mov ax,0401h ; this verify should fail if the heads
- mov cx,seek_num ; are truely at the last cyl
- mov dx,0080h
- int 19
- jc endvl
- m_cyl: mov cx,1 ; not at the last cyl, do loop once more
- jmp verlp
- ;
- endvl: mov ah,9 ; 'System halted'
- mov dx,offset prompt3
- int 33
- cli ; halt system
- hlt
- ;
- start endp
- ;
- seek_num dw 0
- ;
- cr equ 0Dh
- lf equ 0Ah
- ;
- promptc db cr,lf
- db ' *** Hard Disk Head Parking Utility ***',cr,lf
- db '(C) Copyright - 1986 Intelligent Controls Inc.',cr,lf
- db ' Mountlake Terrace, WA',cr,lf,lf,'$'
- prompt1 db 'Parking the hard disk',cr,lf,lf
- db 'Number of cylinders: '
- prompth db '$$$$$$'
- prompt2 db cr,lf
- db 'Moving head(s) to the last cylinder',cr,lf,lf,'$'
- prompt3 db 'System now ready to be moved',cr,lf
- db '*** System Halted ***',cr,lf,lf,'$'
- prompte db cr,lf
- db 'No hard disks in this system, returning to DOS',cr,lf,lf,'$'
- park ends
- end start